﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using IQKS.AWP.DataAccessLayer;
using IQKS.AWP.BusinessObject;


namespace IQKS.AWP.BusinessAccessLayer
{
    public class RegionMasterBAL
    {

        public DataSet GetRegionMaster()
        {
            DataSet objDs;
            try
            {
                objDs = new RegionMasterDAL().GetRegionMaster(0);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


        public RegionMasterBO GetRegionMaster(params object[] param)
        {

            RegionMasterBO objLMBo;
            try
            {
                objLMBo = new RegionMasterBO();
                DataSet objDs;
                objDs = new RegionMasterDAL().GetRegionMaster(param);
                if (objDs != null)
                {
                    DataTable objDt = objDs.Tables[0];
                    if (objDt != null)
                    {
                        objLMBo.RegionID = Convert.ToInt32(objDt.Rows[0]["RegionID"]);
                        objLMBo.RegionName = Convert.ToString(objDt.Rows[0]["RegionName"]);
                        objLMBo.IsActive = Convert.ToBoolean(objDt.Rows[0]["IsActive"]);
                    }
                    else
                    {
                        objLMBo = null;
                    }
                }

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objLMBo;
        }


        public object SetRegionMaster(params object[] param)
        {
            try
            {
                return new RegionMasterDAL().SetRegionMaster(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

    }
}
